package com.henu.rescue.service.impl;

import com.henu.rescue.entity.Organization;
import com.henu.rescue.entity.Station;
import com.henu.rescue.entity.VO.StationComplainCount;
import com.henu.rescue.entity.VO.StationMapVO;
import com.henu.rescue.entity.VO.StationVO;
import com.henu.rescue.mapper.StaMapper;
import com.henu.rescue.service.StaService;
import com.henu.rescue.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StaServiceImpl implements StaService {

    @Autowired
    private StaMapper staMapper;

    @Override
    public Integer addSta(Station station) {
        return staMapper.addSta(station);
    }

    @Override
    public Integer delSta(Integer staId) {
        return staMapper.delStaById(staId);
    }

    @Override
    public Integer update(Station station) {
        return staMapper.updateSta(station);
    }

    @Override
    public Page<StationVO> selectStaInfoByPage(Page<StationVO> page) {
        List<StationVO> staList = staMapper.selectStaInfoByPage(page);
        page.setList(staList);
        //查询总数
        int totalCount =staMapper.getCountByPage(page);
        page.setTotalCount(totalCount);
        return page;
    }

    @Override
    public List<Station> selectAll() {
        return staMapper.selectAll();
    }

    @Override
    public List<Station> selectAllLeisure() {
        return staMapper.selectAllLeisure();
    }

    @Override
    public Integer setBusyById(Integer staId) {
        return staMapper.setBusyById(staId);
    }

    @Override
    public String getNameById(Integer stationId) {
        return staMapper.getNameById(stationId);
    }

    @Override
    public Integer getStatusById(Integer stationId) {
        return staMapper.getStatusById(stationId);
    }

    @Override
    public Station getStaById(Integer stationId) {
        return staMapper.getStaById(stationId);
    }

    @Override
    public List<StationComplainCount> getStationComplainCount() {
        return staMapper.getStationComplainCount();
    }

    @Override
    public Integer getCount() {
        return staMapper.getCount();
    }

    @Override
    public List<Station> selectStaByOrgId(Integer orgId) {
        return staMapper.selectStaByOrgId(orgId);
    }

    @Override
    public List<StationMapVO> selectStationMap() {
        return staMapper.selectStationMap();
    }
}
